#include <iostream>
#include <vector>

int gcd(int a, int b) {
  if (b) {
    while ((a %= b) && (b %= a)) 
      ;
  }
  return a + b;
}

std::vector<std::vector<bool>> coprime(int n) {
  std::vector<std::vector<bool>> nvec(n);
  for (int i = 0; i < n; ++i) {
    nvec[i].resize(n);
    for (int j = 0; j < n; ++j) {
      if (gcd(i, j) == 1) {
        nvec[i][j] = true;
      } else {
        nvec[i][j] = false;
      }
    }
  }
  return nvec;
}

int main(int argc, char** argv) {
  if (argc < 2) exit(0);
  int n = std::stoi(argv[1]);
  auto vec = coprime(n);
  for (int i = 0; i < n; i++) {
    std::cout << "\t" << i;
  }
  std::cout << std::endl;
  for (size_t i = 0; i < vec.size(); ++i) {
    std::cout << i;
    for (size_t j = 0; j < vec[i].size(); ++j) {
      std::cout << "\t" << std::boolalpha << vec[i][j];
    }
    std::cout << std::endl;
  }
  return 0;
}
